package com.example.picktrump;

import java.util.Random;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends Activity {
	
	String cardArray[] = {"9c", "9d", "9h", "9s", "10c", "10d", "10h", "10s", "ac", "ad", "ah", "as", "jc", "jd", "jh", "js", "kc", "kd", "kh", "ks", "qc", "qd", "qh", "qs"};
	TextView showTrump = (TextView) findViewById(R.id.pickTrump);
	TextView currentPlayer = (TextView) findViewById(R.id.whatPlayer);
	Button clubs = (Button) findViewById(R.id.clubs);
	Button spades = (Button) findViewById(R.id.spades);
	Button hearts = (Button) findViewById(R.id.hearts);
	Button diamonds = (Button) findViewById(R.id.diamonds);
	int whosPick = 0;
	boolean playerSelectTrump = false;
	
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    
    public void pickupTrump(View view)
    {
    	// Call the deal method here to determine who gets first pick on the trump.
    	// Emulating it now.
    	
    }
    public int player()
    {
    	whosPick++;
    	if (whosPick >= 4)
    	{
    		whosPick = 1;
    		playerSelectTrump = true;
    		clubs.setVisibility(0);
    		hearts.setVisibility(0);
    		spades.setVisibility(0);
    		diamonds.setVisibility(0);
    	}
    	return whosPick;
    }
    
    public void passTrump(View view)
    {
    	int currentplayer = player();
    	currentPlayer.setText("Player: " + currentplayer);	
    }
    
    public void startOver(View view)
    {
    	whosPick = 0;
        Random rand = new Random();
        String trump = cardArray[rand.nextInt(cardArray.length)];
        showTrump.setText("Pick Trump:" + trump);
        currentPlayer.setText("Player: " + player());
    }
}
